

#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <iostream>
#include <vector>


#define print(x)\
        std::cout << (x) << std::endl;

struct sc_event{
        void notify() { print("immediate");}
        void notify(int x) { print("int x");}
};

void sc_spawn(bool flag) {print ("spawn");}


struct sc_log
{
        std::vector<boost::function<void()> > m_log;

        void log(sc_event* e){ m_log.push_back(boost::bind(&sc_event::notify,e)); }
        void log(sc_event* e,int x){ m_log.push_back(boost::bind(&sc_event::notify,e,x)); }
        void log(bool f){ m_log.push_back(boost::bind(&sc_spawn,f)); }

        void process(){
                for(int i=0; i<m_log.size(); ++i){
                        m_log[i]();
                }
        }
};


int main(int argc,char** argv){

        sc_log l;
        l.log(new sc_event);
        l.log(new sc_event,5);
        l.log(false);

        l.process();
        return 0;
}
